class Solution {
public:
    bool checkRecord(string s) {
        int ATimes = 0, LTimes = 0;
        for (auto& c: s) {
            if (c == 'A') {
                ATimes++;
                if (ATimes >= 2) return false;
            }
            if (c == 'L') LTimes++;
            else LTimes = 0;
            if (LTimes == 3) return false;
        }
        return true;
    }
};